package com.hll.service.role;

import com.hll.dao.BaseDao;
import com.hll.dao.role.RoleDao;
import com.hll.dao.role.RoleDaoImpl;
import com.hll.pojo.Role;

import java.sql.Connection;
import java.util.List;

/**
 * @author: Mr.Hu
 * @create: 2021-03-08 15:19
 */
public class RoleServiceImpl implements RoleService {
  private RoleDao roleDao;

  public RoleServiceImpl() {
    roleDao = new RoleDaoImpl();
  }

  @Override
  public List<Role> getRoleList() {
    List<Role> roles = null;
    Connection connection = null;
    try {
      connection = BaseDao.getConnection();
      roles = roleDao.getRoleList(connection);
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      BaseDao.release(connection, null, null);
    }
    return roles;
  }
}
